package com.xzc.scl.a1_simple_provider.controller;

import com.xzc.scl.a1_simple_provider.dao.UserRepository;
import com.xzc.scl.a1_simple_provider.po.UserPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

@RestController
public class UserController {
    @Autowired
    private UserRepository userRepository;

    @GetMapping("/{id}")
    public UserPo findById(@PathVariable Long id) {
        Optional<UserPo> one = this.userRepository.findById(id);
        return one.orElse(null);
    }
}
